<?php
/**
 *	KLF Framework
 *
 *	Written by Kristian Oye <kristianoye@gmail.com> on Oct 22, 2011
 *	Copyright (C) 2010-2011
 */
namespace KLF\System\Config
{
	use \KLF\System\Errors\KFileNotFoundException;
	
	/**
	 *  Class KApplicationConfiguration
	 *
	 *  Configuration file for applications.
	 *
	 *  @package KLF\System\Config
	 *  @access public
	 *  @author Kristian Oye <kristianoye@gmail.com>
	 *  @since 0.1
	 *  
	 *  @method KApplicationConfiguration NewInstance
	 *  
	 *  @property string $ConfigurationFile The file that the configuration data was read from.
	 */
	abstract class KApplicationConfiguration extends KConfiguration
	{
		public function __construct($parm)
		{
			parent::__construct($parm);
		}
		
		/**
		 * Returns the application class name to be created.
		 *
		 * @author Kristian Oye <kristianoye@gmail.com>
		 * @since 0.1
		 * @return string The class name to be created.
		*/
		public function GetApplicationClass()
		{
			return $this->GetValue("ApplicationClass");
		}
		
		public function ApplicationSetting($appKey)
		{
			if (isset($this->_rpropRawSettings["AppSettings"][$appKey]))
				return $this->_rpropRawSettings["AppSettings"][$appKey];
			else
				return NULL;
		}
		
		/**
		 * Returns a connection string container.
		 * 
		 * @author Kristian Oye <kristianoye@gmail.com>
		 * @since 0.1
		 * @param string $connectionName Returns a named connection.
		 * @return KConnectionString $connectionName
		 */
		public function ConnectionString($connectionName)
		{
			if (isset($this->_rpropRawSettings["ConnectionStrings"][$connectionName]))
				return $this->_rpropRawSettings["ConnectionStrings"][$connectionName];
			else
				return NULL;
		}
	}
}